import { request } from '@@/exports';

export function createCustomer(data: any) {
  return request('/customer', {
    method: 'post',
    data,
  });
}

export function getCustomer(params: any, options?: { [key: string]: any }) {
  if (options) {
    const keys = Object.keys(options);
    params.sortField = keys[0];
    params.sortOrder = options[keys[0]];
  }
  return request('/customer', {
    method: 'get',
    params,
  });
}

export function getCustomerById(id: string) {
  return request(`/customer/${id}`, {
    method: 'get',
  });
}
